<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="author" content="二口丝连连二口，十八相与与十八">
    
    <meta name="description" content="一花一草一世界">
    
    
    
    
    
    
    <title>JavaScript的一些常见基础用法（三） | Tlin Blog</title>
    <link href=”“ rel=”prefetch” />

    <link rel="stylesheet" href="/css/bootstrap.min.css">
<link rel="stylesheet" href="/css/aos.css">
<link rel="stylesheet" href="/css/style.css">
    <script src="/js/jquery.min.js"></script>
    <script src="/js/bootstrap.min.js"></script>
    <script src="/js/aos.js"></script>
    <script src="/js/highslide/highslide-full.min.js"></script>
    <link rel="stylesheet" href="/js/highslide/highslide.css">
    <style type="text/css">
        @media (max-width: 768px) {
            body {
                background-color: #f0f0f0;
                background: url('/imgs/xsbg.gif');
                background-attachment: fixed;
            }
        }
    </style>
    
    <!--<script type="text/javascript">
      if (document.images) {
        var avatar = new Image();
        avatar.src = '/imgs/avatar.jpg'
        var previews = 'preview1.jpg,preview2.jpg,preview3.jpg'.split(',')
        var previewsPreLoad = []
        for(var i = 0; i < length; i++) {
          previewsPreLoad.push(new Image())
          previewsPreLoad[previewsPreLoad.length - 1].src = '/imgs/preview' + previews[i]
        }
      }
    </script>-->
</head>
<body>
    <!-- 背景轮播图功能 -->
    <section class="hidden-xs">
    <ul class="cb-slideshow">
        <li><span>天若</span></li>
        <li><span>有情</span></li>
        <li><span>天亦老</span></li>
        <li><span>人间</span></li>
        <li><span>正道</span></li>
        <li><span>是沧桑</span></li>
    </ul>
</section>
    <!-- 欧尼酱功能, 谁用谁知道 -->
    
    <div class="gal-menu gal-dropdown">
    <div class="circle" id="gal">
        <div class="ring">
            <a href="/" class="menuItem" style="left: 50%; top: 15%;">首页</a>
            
            <a class="menuItem" style="left: 80.3109%; top: 32.5%;">下一页</a>
            
            <a href="/archives" class="menuItem" style="left: 80.3109%; top: 67.5%;">归档</a>
            <a href="javascript:window.location.reload()" class="menuItem" style="left: 50%; top: 85%;">刷新</a>
            <a href="/message" class="menuItem" style="left: 19.6891%; top: 67.5%;">留言板</a>
            
            <a class="menuItem" style="left: 19.6891%; top: 32.5%;">上一页</a>
            
            <a class="menuItem" style="left: 50%; top: 50%;">自动复制</a>
        </div>
        <!-- <audio id="audio" src="/imgs/oni.mp3"></audio> -->
    </div>
</div>
<script>
    // document.getElementById('copy').onclick=function(){
document.onmouseup=function(){
    var txt = window.getSelection?window.getSelection():document.selection.createRange().text;
    document.execCommand("Copy") 
}
    // }
</script>
    
    <header class="navbar navbar-inverse" id="gal-header">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed"
                    data-toggle="collapse" data-target=".bs-navbar-collapse"
                    aria-expanded="false">
                <span class="fa fa-lg fa-reorder"></span>
            </button>
            <a href="/">
                
                <style>
                    #gal-header .navbar-brand {
                        height: 54px;
                        line-height: 24px;
                        font-size: 28px;
                        opacity: 1;
                        background-color: rgba(0,0,0,0);
                        text-shadow: 0 0 5px #fff,0 0 10px #fff,0 0 15px #fff,0 0 20px #228DFF,0 0 35px #228DFF,0 0 40px #228DFF,0 0 50px #228DFF,0 0 75px #228DFF;
                    }
                </style>
                <!-- 这里使用文字(navbar_text or config.title) -->
                <div class="navbar-brand">Tlin</div>
                
            </a>
        </div>
        <div class="collapse navbar-collapse bs-navbar-collapse">
            <ul class="nav navbar-nav" id="menu-gal">
                
                
                <li class="">
                    <a href="/">
                        <i class="fa fa-home"></i>首页
                    </a>
                </li>
                
                
                
                <li class="">
                    <a href="/archives">
                        <i class="fa fa-archive"></i>归档
                    </a>
                </li>
                
                
                
                
                <li class="dropdown">
                    <!-- TODO 添加hover dropdown效果 -->
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown"
                       aria-haspopup="true" aria-expanded="false" data-hover="dropdown">
                        <i class="fa fa-list"></i>分类
                    </a>
                    <ul class="dropdown-menu">
                        
                        
                        <li>
                            <a href="/categories/音频-视频/">音频 视频</a>
                        </li>
                        
                        <li>
                            <a href="/categories/有趣小东西/">有趣小东西</a>
                        </li>
                        
                        <li>
                            <a href="/categories/hexo/">hexo</a>
                        </li>
                        
                        
                        <li>
                            <a href="/categories">...</a>
                        </li>
                        
                        
                    </ul>
                </li>
                
                
                
                
                
                <li class="dropdown">
                    <!-- TODO 添加hover dropdown效果 -->
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown"
                       aria-haspopup="true" aria-expanded="false" data-hover="dropdown">
                        <i class="fa fa-tags"></i>标签
                    </a>
                    <ul class="dropdown-menu">
                        
                        
                        <li>
                            <a href="/tags/audio-video/">audio video</a>
                        </li>
                        
                        <li>
                            <a href="/tags/funny/">funny</a>
                        </li>
                        
                        <li>
                            <a href="/tags/hexo/">hexo</a>
                        </li>
                        
                        
                        <li>
                            <a href="/tags">...</a>
                        </li>
                        
                        
                    </ul>
                </li>
                
                
                
                
                <li class="">
                    <a href="/about">
                        <i class="fa fa-user"></i>关于我
                    </a>
                </li>
                
                
                
                <li class="">
                    <a href="/message">
                        <i class="fa fa-heart"></i>留言板
                    </a>
                </li>
                
                
            </ul>
        </div>
    </div>
</header>
    <div id="gal-body">
        <div class="container">
            <div class="row">
                <div class="col-md-8 gal-right" id="mainstay">
                    
<article class="article well article-body" id="article">
    <div class="breadcrumb">
        <i class="fa fa-home"></i>
        <a href="/">Tlin Blog</a>
        >
        <span>JavaScript的一些常见基础用法（三）</span>
    </div>
    <!-- 大型设备详细文章 -->
    <div class="hidden-xs">
        <div class="title-article">
            <h1>
                <a href="/2019/03/05/javascript/basic3/">JavaScript的一些常见基础用法（三）</a>
            </h1>
        </div>
        <div class="tag-article">
            
            <span class="label label-gal">
                <i class="fa fa-tags"></i>
                
                <a href="/tags/javascript/">javascript</a>
                
            </span>
            
            <span class="label label-gal">
                <i class="fa fa-calendar"></i> 2019-03-05
            </span>
            
        </div>
    </div>
    <!-- 小型设备详细文章 -->
    <div class="visible-xs">
        <center>
            <div class="title-article">
                <h4>
                    <a href="/2019/03/05/javascript/basic3/">JavaScript的一些常见基础用法（三）</a>
                </h4>
            </div>
            <p>
                <i class="fa fa-calendar"></i> 2019-03-05
            </p>
            <p>
                
                <i class="fa fa-tags"></i>
                
                <a href="/tags/javascript/">javascript</a>
                
                
                
            </p>
        </center>
    </div>
    <div class="content-article">
        <h3 id="一、localStorage和sessionStorage"><a href="#一、localStorage和sessionStorage" class="headerlink" title="一、localStorage和sessionStorage"></a>一、localStorage和sessionStorage</h3><ul>
<li>在HTML5中，新加入了一个localStorage特性，这个特性主要是用来作为本地存储来使用的，解决了cookie存储空间不足的问题(cookie中每条cookie的存储空间为4k)，localStorage中一般浏览器支持的是5M大小，这个在不同的浏览器中localStorage会有所不同。<h5 id="优势："><a href="#优势：" class="headerlink" title="优势："></a>优势：</h5></li>
<li>1、localStorage拓展了cookie的4K限制</li>
<li>2、localStorage会可以将第一次请求的数据直接存储到本地，这个相当于一个5M大小的针对于前端页面的数据库，相比于cookie可以节约带宽，但是这个却是只有在高版本的浏览器中才支持的<h5 id="局限："><a href="#局限：" class="headerlink" title="局限："></a>局限：</h5></li>
<li>1、浏览器的大小不统一，并且在IE8以上的IE版本才支持localStorage这个属性</li>
<li>2、目前所有的浏览器中都会把localStorage的值类型限定为string类型</li>
<li>3、localStorage在浏览器的隐私模式下面是不可读取的</li>
<li>4、localStorage不能被爬虫抓取到</li>
<li>5、localStorage本质上是对字符串的读取，如果存储内容多的话会消耗内存空间，会导致页面变卡，目前可以忽略。<h5 id="localStorage和sessionStorage的区别"><a href="#localStorage和sessionStorage的区别" class="headerlink" title="localStorage和sessionStorage的区别"></a>localStorage和sessionStorage的区别</h5></li>
<li>localStorage是永久的储存在浏览器里，只要你不手动清除它就会一直存在</li>
<li>sessionStorage是暂时储存，只要把浏览器关闭就会自动清除，注意，是关闭所有同种浏览器才能清除</li>
<li><strong>localStorage和sessionStorage的用法一致。</strong><h5 id="localStorage的使用"><a href="#localStorage的使用" class="headerlink" title="localStorage的使用"></a>localStorage的使用</h5></li>
<li>浏览器支持情况：<img src="/images/js/basic/loc.jpg" alt=""></li>
<li><p><strong><em>判断浏览器是否支持：</em></strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">if(window.localStorage)&#123;</span><br><span class="line">    console.log(&apos;浏览器支持localstroage&apos;)</span><br><span class="line">&#125;</span><br><span class="line">else&#123;</span><br><span class="line">	alert(&apos;你的浏览器不支持localstroage!&apos;)</span><br><span class="line">    // IE低版本不支持用UserData(不说明)</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
</li>
<li><p><strong>1、设置</strong></p>
</li>
<li><p><code>window.localStorage.setItem(&#39;key&#39;, &#39;value&#39;);</code> // 键、值 值可以是一个变量 </p>
</li>
<li><p><strong>2、获取</strong> </p>
</li>
<li><p><code>window.localStorage.getItem(&#39;key&#39;);</code></p>
</li>
<li><p><strong>3、清除</strong></p>
</li>
<li><code>localStorage.removeItem(&#39;key&#39;);</code> //清除一条</li>
<li><code>window.localStorage.clear();</code>    //清除全部<br><img src="/images/js/basic/locals.png" alt=""></li>
</ul>
<h5 id="提示："><a href="#提示：" class="headerlink" title="提示："></a>提示：</h5><ul>
<li>webStorage的使用也是遵循同源策略的，所以不同的网站直接是不能共用相同的webStorage</li>
<li>webStorage常用来储存一些数据，如登录信息</li>
<li>webStorage转换成为字符串形式，一般我们会将可以使用JSON.stringify()这个方法将JSON存入localStorage中，读取时就是JSON字符串<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">var data=&#123;</span><br><span class="line">        name:&apos;小明&apos;,</span><br><span class="line">        sex:&apos;男&apos;,</span><br><span class="line">        hobby:&apos;编程&apos;</span><br><span class="line">    &#125;;</span><br><span class="line">var info=JSON.stringify(data)</span><br><span class="line">if(window.localStorage)&#123;</span><br><span class="line">    window.localStorage.setItem(&apos;info&apos;,info)</span><br><span class="line">    console.log(window.localStorage.getItem(&apos;info&apos;))</span><br><span class="line">&#125;</span><br><span class="line">else&#123;</span><br><span class="line">    alert(&apos;你的浏览器不支持localstroage!&apos;)</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
</li>
</ul>
<h3 id="二、cookie"><a href="#二、cookie" class="headerlink" title="二、cookie"></a>二、cookie</h3><p><img src="/images/js/basic/cookie1.PNG" alt=""></p>
<ul>
<li><strong>注意：</strong>javascript在chrome浏览器中不支持本地调试cookie，用firefox亲测可以，如果一定要在chrome中调试，要将代码放到服务器才可以调试。<h5 id="创建"><a href="#创建" class="headerlink" title="创建"></a>创建</h5></li>
<li><code>document.cookie=&quot;username=张三&quot;;</code></li>
<li>可以为 cookie 添加一个过期时间（以 UTC 或 GMT 时间）。默认情况下，cookie 在浏览器关闭时删除：</li>
<li><code>document.cookie=&quot;username=李四; expires=Thu, 18 Dec 2043 12:00:00 GMT&quot;;</code> // 可以用Date()函数来设置，详细看后面</li>
<li>可以使用 path 参数告诉浏览器 cookie 的路径。默认情况下，cookie 属于当前页面。</li>
<li><code>document.cookie=&quot;username=王五; expires=Thu, 18 Dec 2043 12:00:00 GMT; path=/&quot;;</code><br><img src="/images/js/basic/cookie2.PNG" alt=""><h5 id="读取"><a href="#读取" class="headerlink" title="读取"></a>读取</h5></li>
<li><code>var c= document.cookie;</code> // 读取该网站的全部cookie，如：cookie1=value; cookie2=value……</li>
<li>返回指定的cookie看后面的示例</li>
</ul>
<h5 id="修改"><a href="#修改" class="headerlink" title="修改"></a>修改</h5><ul>
<li>修改cookie类似于创建cookie，旧的cookie被新的覆盖</li>
<li><code>document.cookie=&quot;username=张三&quot;;</code></li>
</ul>
<h5 id="删除"><a href="#删除" class="headerlink" title="删除"></a>删除</h5><ul>
<li>只需要设置 expires 参数为以前的时间即可</li>
<li><code>document.cookie = &quot;username=张三; expires=Thu, 01 Jan 1970 00:00:00 GMT&quot;;</code></li>
</ul>
<h5 id="示例："><a href="#示例：" class="headerlink" title="示例："></a>示例：</h5><ul>
<li><p><strong>设置cookie</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">function setCookie(key,value,exdays)</span><br><span class="line">&#123;</span><br><span class="line">  var d = new Date();</span><br><span class="line">  d.setTime(d.getTime()+(exdays*24*60*60*1000));</span><br><span class="line">  var expires = &quot;expires=&quot;+d.toGMTString();</span><br><span class="line">  document.cookie = key + &quot;=&quot; + value + &quot;; &quot; + expires;</span><br><span class="line">&#125;</span><br><span class="line">setCookie(&apos;username&apos;,&apos;张三&apos;,1) //exdays为0或负数时删除该cookie</span><br></pre></td></tr></table></figure>
</li>
<li><p><strong>获取cookie</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">function getCookie(cname)&#123;</span><br><span class="line">	var name = cname + &quot;=&quot;;</span><br><span class="line">	var arr = document.cookie.split(&apos;;&apos;);</span><br><span class="line">	for(var i=0; i&lt;arr.length; i++) &#123;</span><br><span class="line">		var c = arr[i].trim();</span><br><span class="line">		if (c.indexOf(name)==0) &#123; </span><br><span class="line">            return c.substring(name.length,c.length); // 返回用户指定的cookie</span><br><span class="line">        &#125;</span><br><span class="line">	&#125;</span><br><span class="line">	return &quot;&quot;;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
</li>
<li><p><strong>检测cookie</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">function checkCookie()&#123;</span><br><span class="line">	var user=getCookie(&quot;username&quot;);</span><br><span class="line">	if (user!=&quot;&quot;)&#123;</span><br><span class="line">		alert(&quot;欢迎 &quot; + user + &quot; 再次访问&quot;);</span><br><span class="line">	&#125;</span><br><span class="line">	else &#123;</span><br><span class="line">		user = prompt(&quot;请输入你的名字:&quot;,&quot;&quot;);</span><br><span class="line">  		if (user!=&quot;&quot; &amp;&amp; user!=null)&#123;</span><br><span class="line">    		setCookie(&quot;username&quot;,user,7);</span><br><span class="line">    	&#125;</span><br><span class="line">	&#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
</li>
</ul>
<p><a href="http://www.runoob.com/try/try.php?filename=tryjs_cookie_username" target="_blank" rel="noopener">查看菜鸟教程演示页面</a></p>
<h5 id="注意事项"><a href="#注意事项" class="headerlink" title="注意事项"></a>注意事项</h5><ul>
<li>1、Chrome中过期时间可能会出错，因为它用的是格林尼治时间，北京时间会多出8小时；</li>
<li>2、服务器的时间和时区设置会影响cookie；</li>
<li>3、每条cookie只有4k大小，储存有限但是几乎都是敏感的信息，如账号密码；</li>
<li>4、当cookie过多超过浏览器预定的数目后，有的浏览器会智能清除一些cookie。</li>
</ul>

    </div>
</article>


<div id="comments-template"></div>
<link rel="stylesheet" href="https://imsun.github.io/gitment/style/default.css">
<script>
	if(!window.commentConfig) {
      window.commentConfig = {}
      window.commentConfig.title = 'JavaScript的一些常见基础用法（三）'
    }
</script>

                </div>
                <aside class="col-md-4 gal-left" id="sidebar">
    <!-- 此为sidebar的搜索框, 非搜索结果页面 -->
<aside id="sidebar-search">
    <div class="search hidden-xs" data-aos="fade-up" data-aos-duration="2000">
        <form class="form-inline clearfix" id="search-form" method="get"
              action="/search/index.html">
            <input type="text" name="s" class="form-control" id="searchInput" placeholder="搜索文章~">
            <button class="btn btn-danger btn-gal" type="submit">
                <i class="fa fa-search"></i>
            </button>
        </form>
    </div>
</aside>
    <aside id="sidebar-author">
    <div class="panel panel-gal" data-aos="flip-right" data-aos-duration="3000">
        <div class="panel-heading" style="text-align: center">
            <i class="fa fa-quote-left"></i>
            二口丝连连二口，十八相与与十八
            <i class="fa fa-quote-right"></i>
        </div>
        <div class="author-panel text-center">
            <img src="/imgs/avatar.jpg" width="140" height="140"
                 alt="个人头像" class="author-image">
            <p class="author-description"><h3 style="text-decoration:underline;"><p>一花一草一世界</p>
</h3></p>
        </div>
    </div>
</aside>
    
    <aside id="sidebar-recent_comments">
    <div class="panel panel-gal recent hidden-xs" data-aos="fade-up" data-aos-duration="2000">
        <div class="panel-heading">
            <i class="fa fa-comments"></i>
            最新评论
            <i class="fa fa-times-circle panel-remove"></i>
            <i class="fa fa-chevron-circle-up panel-toggle"></i>
        </div>
        <ul class="list-group list-group-flush"></ul>
    </div>
</aside>
    
    <!-- 要配置好leancloud才能开启此小工具 -->
    
    
    <aside id="sidebar-recent_posts">
    <div class="panel panel-gal recent hidden-xs" data-aos="fade-up" data-aos-duration="2000">
        <div class="panel-heading">
            <i class="fa fa-refresh"></i>
            近期文章
            <i class="fa fa-times-circle panel-remove"></i>
            <i class="fa fa-chevron-circle-up panel-toggle"></i>
        </div>
        <ul class="list-group list-group-flush">
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2019/11/14/javascript/js_copy/">JS复制选中的内容</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2019/11/13/audio video/mp4_play/">MP4网页播放器</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2019/11/13/html css/underlineStyle/">设置下划线样式</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2019/03/05/website/learning_website/">学习网站 学习社区</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2019/03/05/web/angular_upgrade/">AngularJs+Bootstrap搭建首页导航路由（升级）</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2019/03/05/vue/vue_cli/">Vue-cli脚手架工具搭建项目（详细）</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2019/03/05/web/angular/">AngularJs+Bootstrap搭建首页导航路由</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2019/03/05/vue/vue_babel/">Vue项目引入的一些包</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2019/03/05/tools/tools/">电脑实用的一些工具软件</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2019/03/05/plugins/cool-plugins/">炫酷特效插件</a>
                </span>
            </li>
            
        </ul>
    </div>
</aside>
    
    
    <aside id="sidebar-rand_posts">
    <div class="panel panel-gal recent hidden-xs" data-aos="fade-up" data-aos-duration="2000">
        <div class="panel-heading">
            <i class="fa fa-refresh"></i>
            随机文章
            <i class="fa fa-times-circle panel-remove"></i>
            <i class="fa fa-chevron-circle-up panel-toggle"></i>
        </div>
        <ul class="list-group list-group-flush">
            
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2019/03/05/audio video/mp4_attention/">MP4转码在网页播放要注意的两个坑</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2019/03/05/funny/chat_robot/">聊天机器人</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2019/03/05/hexo/hexo_options/">修改hexo主题及其配置</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2019/03/05/hexo/hexo/">运用码云搭建hexo博客（详细）</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2019/03/05/html css/base2/">HTML+CSS基础（三）</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2019/11/13/html css/underlineStyle/">设置下划线样式</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2019/03/05/html css/basis/">HTML+CSS基础（一）</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2019/11/14/javascript/js_copy/">JS复制选中的内容</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2019/03/05/javascript/form/">Form表单提交</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2019/03/05/vue/vue_cli/">Vue-cli脚手架工具搭建项目（详细）</a>
                </span>
            </li>
            
        </ul>
    </div>
</aside>
    
    
    <aside id="gal-sets">
        <div class="panel panel-gal hidden-xs" data-aos="fade-up" data-aos-duration="2000">
            <ul class="nav nav-pills pills-gal">
                <li class="">
                    <a href="/2019/03/05/javascript/basic3/index.html#sidebar-tags" data-toggle="tab" id="tags-tab">热门标签</a>
                </li>
                <li class="">
                    <a href="/2019/03/05/javascript/basic3/index.html#sidebar-friend-links" data-toggle="tab" id="friend-links-tab">友情链接</a>
                </li>
                <li class="">
                    <a href="/2019/03/05/javascript/basic3/index.html#sidebar-links" data-toggle="tab" id="links-tab">个人链接</a>
                </li>
            </ul>
            <div class="tab-content">
                <div class="cloud-tags tab-pane nav bs-sidenav fade" id="sidebar-tags">
    
    <a href="/tags/audio-video/" style="font-size: 15.213572937885015px;" class="tag-cloud-link">audio video</a>
    
    <a href="/tags/funny/" style="font-size: 11.157310306858166px;" class="tag-cloud-link">funny</a>
    
    <a href="/tags/hexo/" style="font-size: 14.269055420656773px;" class="tag-cloud-link">hexo</a>
    
    <a href="/tags/html-css/" style="font-size: 13.356269415284704px;" class="tag-cloud-link">html css</a>
    
    <a href="/tags/markdown/" style="font-size: 16.544099221459305px;" class="tag-cloud-link">markdown</a>
    
    <a href="/tags/javascript/" style="font-size: 19.83256037776934px;" class="tag-cloud-link">javascript</a>
    
    <a href="/tags/琐记/" style="font-size: 19.22838303615128px;" class="tag-cloud-link">琐记</a>
    
    <a href="/tags/特效插件/" style="font-size: 15.689580991496847px;" class="tag-cloud-link">特效插件</a>
    
    <a href="/tags/实用插件/" style="font-size: 12.842919600129354px;" class="tag-cloud-link">实用插件</a>
    
    <a href="/tags/vue/" style="font-size: 8.436048206435009px;" class="tag-cloud-link">vue</a>
    
    <a href="/tags/tools/" style="font-size: 8.97399732575589px;" class="tag-cloud-link">tools</a>
    
    <a href="/tags/web/" style="font-size: 11.27843524783251px;" class="tag-cloud-link">web</a>
    
    <a href="/tags/学习网站-学习社区/" style="font-size: 11.989622139388992px;" class="tag-cloud-link">学习网站 学习社区</a>
    
</div>
                <div class="friend-links tab-pane nav bs-sidenav fade" id="sidebar-friend-links">
    
    <li>
        <a href="https://hexo.io/zh-cn/" target="_blank">Hexo</a>
    </li>
    
    <li>
        <a href="https://www.npmjs.com/" target="_blank">npm</a>
    </li>
    
    <li>
        <a href="https://user.qzone.qq.com/3287108795?source=namecardhoverqzone" target="_blank">个人空间（非好友可能看不了）</a>
    </li>
    
</div>
                <div class="links tab-pane nav bs-sidenav fade" id="sidebar-links">
    
    <li>
        <a href="https://github.com/tianrenlin/" target="_blank">Github</a>
    </li>
    
    <li>
        <a href="https://gitee.com/tilin" target="_blank">Gitee（码云）</a>
    </li>
    
    <li>
        <a href="https://segmentfault.com/u/tianlin" target="_blank">SegmentFault（思否）</a>
    </li>
    
</div>
            </div>
        </div>
    </aside>
    
</aside>
            </div>
        </div>
    </div>
    <footer id="gal-footer">
    <div class="container">
        Copyright © 2018 <a href="https://tilin.gitee.io/about/" style="color:#39C1D8;">Tlin</a> Powered by <a href="https://hexo.io/" target="_blank">Hexo</a>.&nbsp;
    </div>
</footer>

<!-- 回到顶端 -->
<div id="gal-gotop" title="回到顶部">
    <i class="fa fa-angle-up"></i>
</div>
<script src="/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"pluginRootPath":"live2dw/","pluginJsPath":"lib/","pluginModelPath":"assets/","tagMode":false,"debug":false,"model":null,"use":"live2d-widget-model-z16","mobile":{"show":false},"dialog":{"enable":true},"log":false});</script></body>
<script src="/js/activate-power-mode.js"></script>
<script>

    // 配置highslide
	hs.graphicsDir = '/js/highslide/graphics/'
    hs.outlineType = "rounded-white";
    hs.dimmingOpacity = 0.8;
    hs.outlineWhileAnimating = true;
    hs.showCredits = false;
    hs.captionEval = "this.thumb.alt";
    hs.numberPosition = "caption";
    hs.align = "center";
    hs.transitions = ["expand", "crossfade"];
    hs.lang.number = '共%2张图, 当前是第%1张';
    hs.addSlideshow({
      interval: 5000,
      repeat: true,
      useControls: true,
      fixedControls: "fit",
      overlayOptions: {
        opacity: 0.75,
        position: "bottom center",
        hideOnMouseOut: true
      }
    })

    // 初始化aos
    AOS.init({
      duration: 1000,
      delay: 0,
      easing: 'ease-out-back'
    });

</script>
<script>
	POWERMODE.colorful = 'true';    // make power mode colorful
	POWERMODE.shake = 'true';       // turn off shake
	// TODO 这里根据具体情况修改
	document.body.addEventListener('input', POWERMODE);
</script>
<script>
    window.slideConfig = {
      prefix: '/imgs/slide/background',
      ext: 'jpg',
      maxCount: '6'
    }
</script>
<script src="/js/hs.js"></script>
<script src="/js/blog.js"></script>

<script src="/js/oni.js"></script>



<script src="https://imsun.github.io/gitment/dist/gitment.browser.js"></script>
<script>
    if(window.commentConfig) {
      window.commentConfig.id = 'Tue Mar 05 2019 23:00:21 GMT+0800'
      window.commentConfig.owner = 'tianrenlin'
      window.commentConfig.repo = 'tilin_comments'
      window.commentConfig.client_id = 'a1c64988f8052e784d45'
      window.commentConfig.client_secret = 'a7eb4fff9e6c2d418ae487de38e3153bfe17c06c'
      window.commentConfig.redirect_uri = ''
    } else {
      window.commentConfig = {
      	id: 'Tue Mar 05 2019 23:00:21 GMT+0800',
        owner: 'tianrenlin',
        repo: 'tilin_comments',
        client_id: 'a1c64988f8052e784d45',
        client_secret: 'a7eb4fff9e6c2d418ae487de38e3153bfe17c06c',
        redirect_uri: ''
      }
    }
</script>
<script src="/js/comment/gitment.js"></script>

</html>
<script>
    !function(e,t,a){function n(){c(".heart{width: 10px;height: 10px;position: fixed;background: #f00;transform: rotate(45deg);-webkit-transform: rotate(45deg);-moz-transform: rotate(45deg);}.heart:after,.heart:before{content: '';width: inherit;height: inherit;background: inherit;border-radius: 50%;-webkit-border-radius: 50%;-moz-border-radius: 50%;position: fixed;}.heart:after{top: -5px;}.heart:before{left: -5px;}"),o(),r()}function r(){for(var e=0;e<d.length;e++)d[e].alpha<=0?(t.body.removeChild(d[e].el),d.splice(e,1)):(d[e].y--,d[e].scale+=.004,d[e].alpha-=.013,d[e].el.style.cssText="left:"+d[e].x+"px;top:"+d[e].y+"px;opacity:"+d[e].alpha+";transform:scale("+d[e].scale+","+d[e].scale+") rotate(45deg);background:"+d[e].color+";z-index:99999");requestAnimationFrame(r)}function o(){var t="function"==typeof e.onclick&&e.onclick;e.onclick=function(e){t&&t(),i(e)}}function i(e){var a=t.createElement("div");a.className="heart",d.push({el:a,x:e.clientX-5,y:e.clientY-5,scale:1,alpha:1,color:s()}),t.body.appendChild(a)}function c(e){var a=t.createElement("style");a.type="text/css";try{a.appendChild(t.createTextNode(e))}catch(t){a.styleSheet.cssText=e}t.getElementsByTagName("head")[0].appendChild(a)}function s(){return"rgb("+~~(255*Math.random())+","+~~(255*Math.random())+","+~~(255*Math.random())+")"}var d=[];e.requestAnimationFrame=function(){return e.requestAnimationFrame||e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.oRequestAnimationFrame||e.msRequestAnimationFrame||function(e){setTimeout(e,1e3/60)}}(),n()}(window,document);
</script>